#include "llt.h"

#include <pony/sensor/stts22h.h>

#include <stdio.h>

void test_stts22h_demo(void **state)
{
    hal_i2c_dev_t *dev = hal_i2c_dev_open("stts22h");
    assert_true(dev != NULL);

    uint8_t id = stts22h_read_id(dev);
    assert_int_equal(STTS22H_ID, id);

    int16_t temp = 0;
    int ret = stts22h_read_temp(dev, &temp);
    assert_int_equal(0, ret);

    printf("temp: %d.%d 'C\n", temp / 100, temp % 100);
}

/** test entry */

void test_stts22h(struct tester_case *caser)
{
    UnitTest tests[] = {
        unit_test(test_stts22h_demo),
    };

    caser->stats->totals = sizeof(tests) / sizeof(tests[0]);
    caser->stats->fails = run_tests(tests);
}

TESTER_CASE_DEF("test_stts22h", test_stts22h, NULL, NULL, 0);
